package com.marui.ch1;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author marui
 * @date 16:12 2020/5/15
 * @since 1.0
 */
public class MyTest {
    private static AtomicInteger  num = new AtomicInteger();


    public static void main(String[] args) throws InterruptedException {



        Integer a = 3;
        Integer b = 3;
        System.out.println("a=b?" + (a == b));

        Integer c = 273;
        Integer d = 273;
        System.out.println("c=d?" + (c == d));


        Thread t1 = new Thread(new MyInnerRunnable(),"t1");
        Thread t2 = new Thread(new MyInnerRunnable(),"t2");
        Thread t3 = new Thread(new MyInnerRunnable(),"t3");
        if(num.intValue() <= 100){
           t1.join();
           t2.join();
           t1.start();
           t2.start();
           t3.start();
        }
    }


    static class MyInnerRunnable implements  Runnable{

        @Override
        public void run() {
            num.getAndIncrement();
        }
    }

}
